﻿<UserControl x:Class="ConfigurationSetupUtility.Screens.UserAccountCredentialsSetupScreen"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Loaded="UserAccountCredentialsSetupScreen_Loaded"
             d:DesignHeight="400" d:DesignWidth="400" MaxWidth="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=FrameworkElement, AncestorLevel=1}, Path=ActualWidth}">
    <DockPanel>
        <TextBlock Text="Define User Account Credentials" DockPanel.Dock="Top" HorizontalAlignment="Center" FontWeight="Bold" FontSize="16" Margin="5" TextAlignment="Center" />
        
        <StackPanel DockPanel.Dock="Bottom" Orientation="Vertical">
            <TextBlock TextAlignment="Center" Margin="10,2,10,2" TextWrapping="Wrap">
                Please define the credentials for an initial administrative<LineBreak />user account for this openHistorian configuration.
            </TextBlock>
            
            <RadioButton Content="Windows Authentication" Name="RadioButtonWindowsAuthentication" Checked="RadioButtonWindowsAuthentication_Checked" Unchecked="RadioButtonWindowsAuthentication_Unchecked" Margin="125,5,0,0" GroupName="AuthenticationType"/>
            <RadioButton Content="Database Authentication" Name="RadioButtonDatabaseAuthentication" Margin="125,0,0,0" GroupName="AuthenticationType"/>
            
            <GroupBox x:Name="UserAccountGroupBox" Margin="2">
                <GroupBox.Header>
                    <TextBlock x:Name="UserAccountHeaderTextBlock" Text="" FontWeight="Bold" />
                </GroupBox.Header>
                
                <StackPanel Orientation="Vertical" Margin="0">
                    <TextBlock x:Name="MessageTextBlock" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" TextWrapping="Wrap" Margin="5,0" />

                    <Grid x:Name="WindowsInfoGrid" HorizontalAlignment="Left" Margin="5">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="125" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Right">
                            <TextBlock Text="User name:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <TextBox Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Width="150" Grid.Row="0" Grid.Column="1" Name="WindowsUserNameTextBox" Margin="2" TextChanged="WindowsUserNameTextBox_TextChanged" GotFocus="TextBox_GotFocus"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
                            <TextBlock Text="Password:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <PasswordBox Grid.Row="1" Grid.Column="1" Height="23" HorizontalAlignment="Left" Name="WindowsUserPasswordTextBox" VerticalAlignment="Center" Width="150" Margin="2" GotFocus="TextBox_GotFocus"/>

                        <CheckBox x:Name="CheckBoxPassThroughAuthentication" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="40,8,0,5" Content="Allow pass-through authentication for openHistorian Manager" VerticalAlignment="Stretch" HorizontalContentAlignment="Left" IsChecked="True"/>

                        <TextBlock x:Name="TextBlockPassThroughMessage" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,2,5,2" TextWrapping="Wrap">
                            When &quot;allow pass-through authentication&quot; is enabled, system will use current authenticated windows
                            user to attempt login. Otherwise the login dialog will always be displayed.
                        </TextBlock>
                        
                    </Grid>
                    
                    <Grid x:Name="DbInfoGrid" HorizontalAlignment="Left" Margin="5,0,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="125" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Right">
                            <TextBlock Text="User name:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <TextBox Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Width="150" Grid.Row="0" Grid.Column="1" Name="DbUserNameTextBox" Margin="2" GotFocus="TextBox_GotFocus"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
                            <TextBlock Text="Password:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <PasswordBox Grid.Row="1" Grid.Column="1" Height="23" HorizontalAlignment="Left" Name="DbUserPasswordTextBox" VerticalAlignment="Center" Width="150" Margin="2" GotFocus="TextBox_GotFocus"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
                            <TextBlock Text="Confirm Password:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <PasswordBox Grid.Row="2" Grid.Column="1" Height="23" HorizontalAlignment="Left" Name="DbUserConfirmPasswordTextBox" VerticalAlignment="Center" Width="150" Margin="2" GotFocus="TextBox_GotFocus"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right">
                            <TextBlock Text="First Name:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <TextBox Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Width="150" Grid.Row="3" Grid.Column="1" Name="DbUserFirstNameTextBox" Margin="2" GotFocus="TextBox_GotFocus"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="4" HorizontalAlignment="Right">
                            <TextBlock Text="Last Name:" Margin="2" />
                            <TextBlock Text="*" Foreground="Red" />
                        </StackPanel>

                        <TextBox Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Width="150" Grid.Row="4" Grid.Column="1" Name="DbUserLastNameTextBox" Margin="2" GotFocus="TextBox_GotFocus"/>
                    </Grid>
                </StackPanel>
            </GroupBox>     
        </StackPanel>
    </DockPanel>
</UserControl>
